
alter   proc sp_get_ps_line_item_gp_vendor_location
(
	@CSLIT_ID numeric,
	@gp_vendorName VARCHAR(50),
	@gp_location char(11) OUT
)
as
begin

declare @customer_shipping_id int
declare @ps_type varchar(50)

set @gp_location = ''
set @ps_type = ''

--Retreiving the process type
select @ps_type = RTRIM( PS.PS_Type_name ) from Customer_Shipping_Line_Item_Table CSLIT, Customer_Open_Order_LineItem COOL, Product PROD, Process_Step PS where CSLIT.LineItem_ID = COOL.LineItem_ID and COOL.Product_Id = PROD.Product_Id and PROD.ProcessStep_Id = PS.ProcessStep_Id and CSLIT.CSLIT_ID = @CSLIT_ID

if( len( @gp_vendorName ) > 7 )
begin
	set @gp_vendorName = substring( @gp_vendorName, 1, 7 )
end

if( len( @ps_type ) > 3 )
begin
	set @ps_type = substring( @ps_type, 1, 3 )
end

if( @gp_vendorName <> '' and @ps_type <> '' )
begin
	set @gp_location = upper( @gp_vendorName + '/' + @ps_type )
end

end --End of proc
